Skip to content

REF: Simplify checkT1s #1432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 13, 2016
Merged

REF: Simplify checkT1s #1432

merged 1 commit into from
Apr 13, 2016

Conversation

effigies
Copy link
Member

A number of cleanups I saw while looking at #1431.

  • This uses nibabel instead of SimpleITK to determine image shape. SimpleITK is still a dependency in two functions in nipype/workflows/smri/freesurfer/utils.py.
  • From what I could see, the conversion from .mgz to .nii was to allow SimpleITK to load the file, so I removed it.
  • I used list/generator comprehensions to reduce indentation levels and separate unrelated calculations.

@dgellis90 Can you verify that this still behaves as expected in your tests?

Minor change, so forgoing a CHANGES entry unless otherwise instructed.

* Use nibabel instead of SimpleITK to determine image shape
* Do not convert .mgz to .nii
* Simplify error checking and origvol_names with comprehensions
* PEP8 cleanup in/around checkT1s
@ellisdg
Copy link
Contributor

ellisdg commented Apr 12, 2016

@effigies The workflow still performs as expected with your changes.

@effigies
Copy link
Member Author

Great! Thanks for the quick feedback.

Unrelated to this PR (except insofar as I want to get rid of the SimpleITK dependency), could I get some inputs and results to center_volume and recodeLabelMap? These should be pretty easy to rewrite with nibabel, as long as I can check my work.

@satra satra merged commit cbd55e2 into nipy:master Apr 13, 2016
@ellisdg
Copy link
Contributor

ellisdg commented Apr 13, 2016

@effigies No problem! Here is an example with inputs and outputs that uses both: https://www.dropbox.com/s/ovmwprr71lcbi87/recodingexample.tar.gz?dl=0
Let me know if you need anything else.

@effigies
Copy link
Member Author

Do you have some inputs that have an affine matrix that doesn't look like this?

1 0 0 a
0 1 0 b
0 0 1 c
0 0 0 1

I want to understand center_volume. Right now it looks like the algorithm just sets [a, b, c] = [±dim1/2, ±dim2/2, ±dim3/2], but that may simply be a consequence of there being no rotation or scaling.

Incidentally, this seems odd to me, and I want to verify that your goal really is just to adjust the affine matrix, and not to translate the contents of the data array such that you have a nice affine matrix. The consequence of center_volume seems to be to put it out of alignment with other files from the same subject. Admittedly, I haven't looked closely at where the resulting files are used, so this could be a dumb question.

@effigies effigies mentioned this pull request Apr 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants